import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import Layout from '@/views/Layout'
import Home from '@/views/Layout/Home'
import User from '@/views/Layout/User'
import SearchCom from '@/views/SearchCom'
import SearchResult from '@/views/SearchCom/SearchResult'
import ArticleDetail from '@/views/ArticleDetail'
import userEdit from '@/views/Layout/User/userEdit'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout'
  },
  {
    path: '/login',
    component: Login
  }, {
    path: '/layout',
    component: Layout,
    redirect: '/layout/home',
    children: [
      {
        path: 'home',
        component: Home
      },
      {
        path: 'user',
        component: User
      }
    ]
  },
  {
    path: '/search',
    component: SearchCom
  },
  {
    path: '/searchresult/:kw?',
    component: SearchResult
  },
  {
    path: '/articledetail',
    component: ArticleDetail
  },
  {
    path: '/useredit',
    component: userEdit
  }
]

const router = new VueRouter({
  routes
})

export default router
